This invention relates to retrieval of data from a relational database, and, more particularly, to a method of retrieving data using SQL queries from the DB2 database licensed by International Business Machines Corp. ("IBM"). The Structured Query Language (SQL) is a language for accessing data in a relational database. It was originally created by IBM. In the 1980's, The American National Standards Institute (ANSI) and the International Standards Organization (ISO) published SQL standards in 1986 and 1987, respectively. ANSI and ISO jointly worked on an extension to the standards, variously called SQL2, SQL-92, or SQL/92. Another extension to the standards, SQL3, is in progress, to enhance relational capabilities, and add support for object-oriented features.
According to IBM's DB2 glossary, a query to a relational database is a request for information from the database based on specific conditions. For example, a query could be a request for a list of all customers in a customer table who live in Texas.
Also according to IBM's DB2 glossary, in an application host program, embedded Structured Query Language (SQL) statements will reference host variables. Host variables are programming variables in the application program, and are the primary mechanism for transmitting data between tables in the database and application program work areas.
The prior art teaches that in order to reduce response time to SQL queries directed to a relational database, the user must improve his hardware, by buying a faster CPU or adding more space for data storage, or both, or improve his software by providing for more software storage or buffering of data objects. The prior art buffers, or caches, merely raw data. For example, for a query of average salaries, the prior art buffers, or caches, merely the salaries, not the average of those salaries, i.e., the result of the query is not cached.
More specifically, the following limitations exist with DB2: SQL result tables are not saved; the scope of a result table is the program by which it is defined; and result tables can be processed from top to bottom only once.
What is needed is a method of reducing the response time to SQL queries directed to a relational database, without having to increase the hardware requirements, and without having to provide more excessive software caches for data objects. More specifically, what is needed is a program that will eliminate the creation time for all SQL queries except the initial query by saving or caching the results of the query; that will satisfy queries from any source, batch or interactive, from the same cached result tables; that will treat SQL "select into" statements as single-row result tables, and cache them for repetitive availability; and that will save result tables for iterative and multi-source processing.